﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Guest_room.admin;

namespace Guest_room
{
    public partial class Home : Form
    {
        public Home()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            Login l1 = new Login();
            l1.Show();
        }

        private void Label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Register r1 = new Register();
            r1.Show();
        }
        /// <summary>
        /// 一键登录测试用
        /// </summary>
        public static bool flag = false;
        public static bool Aflag = false;
        public static string username, userid;
        private void button3_Click(object sender, EventArgs e)
        {
            // 
            DB.GetCn();
            string str = "select * from 员工账户表 where 用户编号='GL001' and 密码='123' and 员工属性='管理员'";
            DataTable dt = DB.GetDataSet(str);
            if (dt.Rows.Count > 0)
            {
                //MessageBox.Show("登录成功");
                flag = true;
                //username = "E001";
                //this.Close();
                userid = "GL001";
                string str1 = "select 管理员姓名 from 管理员基本信息表 where 管理员编号='GL001'";
                username = DB.GetDataSet(str1).Rows[0][0].ToString();
                admin.index f = new admin.index();
                f.Show();
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
            }
            DB.cn.Close();
        }

        private void home_Load(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            DB.GetCn();
            string str = "select * from 员工账户表 where 用户编号='E001' and 密码='123' and 员工属性='普通员工'";
            DataTable dt = DB.GetDataSet(str);
            if (dt.Rows.Count > 0)
            {
                //MessageBox.Show("登录成功");
                Aflag = true;
                userid = "E001";
                //username = "E001";
                //this.Close();
                string str1 = "select 员工姓名 from 员工基本信息表 where 员工编号='E001'";
                username = DB.GetDataSet(str1).Rows[0][0].ToString();
                //Default f = new Default();
                //f.Show();
                //this.Dispose();
                roin roin = new roin();
                roin.ShowDialog();
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
            }
            DB.cn.Close();
        }

        /// <summary>
        /// 一键登录测试用
        /// </summary>
    }
}
